//
//  HomeTableViewCell.m
//  MyMovie
//
//  Created by Weiwei on 16/2/26.
//  Copyright © 2016年 bever贝沃汇力 weiwei. All rights reserved.
//

#import "HomeTableViewCell.h"

@implementation HomeTableViewCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

//重写setModel方法
-(void)setHomeModel:(HomeModel *)homeModel{
    _homeModel = homeModel;
    
    //拿到数据后，进行属性的复制
    self.title.text = _homeModel.titleCn;
    //注意nsNumber无法直接使用
    float rating = [_homeModel.ratingFinal floatValue];
    self.rating.text = [NSString stringWithFormat:@"%.1f",rating];
    
    //--------imageView增加网路请求图片-------
   //使用第三方框架，请求网络图片
    NSURL* url = [NSURL URLWithString:_homeModel.img];
    [self.imageVie setImageWithURL:url];
    
    //http网络请求安全设置
    //如果你做到这一步，发现没能请求下图片，那么就需要
    //临时解决办法在Info.plist中添加  NSAppTransportSecurity 类型  Dictionary Dictionary 下添加  NSAllowsArbitraryLoads 类型 Boolean ,值设为  YES
    
    //---------给ratingView(starView)一个值-------
    
    float rating2 = [_homeModel.ratingFinal floatValue];
    self.StarView.rating = rating2;
    
    
}

@end
